// pages/dacmode/dacmode.js
var loadcishu = 0,acidacid,sitesite,isRelease
var app = getApp()
Page({
  data: {
    gqmode:true,
    bghei:app.globalData.winheight,
    modalHidden:true,
    acid:'',placemsg:'',site:''
  },
  onLoad:function(options){
    var placemsg = wx.getStorageSync('placemsg')
    this.setData({placemsg:placemsg})
    var acename = ''
    if(loadcishu=='0'){
      loadcishu = 1
      this.setData({acid:options.id,site:options.site})
      acidacid=options.id, sitesite=options.site, isRelease = options.isRelease
      if(options.site==1){
        acename = '朝阳公园'
      }
      if(options.site==2){
        acename = '天泽路'
      }
      if(options.site==3){
        acename = '水长城'
      }
      if(options.site==4){
        acename = '古北水镇'
      }
      if(options.site==5){
        acename = '云顶酒店'
      }
      if(options.site==undefined){
        wx.setNavigationBarTitle({
          title: placemsg.placename,
        })
      }
    }
    wx.setNavigationBarTitle({
      title: acename,
    })
    console.log('模式页面的活动id',options.id)
  },

  danren(){
    var that = this
    var avatar = app.globalData.userInfo.avatarUrl
    var openid = wx.getStorageSync('openid')
    var userinfo = wx.getStorageSync('headimg')
    if(avatar==undefined){
      wx.navigateTo({
        url: '../shouquan/shouquan',
      })
    }
    that.setData({modalHidden:false})
    wx.request({
      url: 'https://www.juquduo.com/juquduo/gaming/privy/join',
      data:{
        activityId:acidacid,
        openid:openid,
        avatar:userinfo.avatarUrl,
        nick_name:userinfo.nickName,
      },
      success(res){
        console.log(res)
      }
    })
    setTimeout(function() {
      that.setData({modalHidden:true})
      // if(plcnm=='天泽路'||site==2){
        var site = that.data.site
        wx.redirectTo({
          // 259是朝阳公园，8个点
          url: '../dgame1/dgame1?id='+acidacid+'&site='+sitesite,
          // url: '../dgame1/dgame1?id='+264+'&site='+3,
        })
      console.log('跳转到dgame1')
    }, 3000)
  },
  toroom(){
    var that = this
    wx.redirectTo({
      url: './roomlist?id='+acidacid+'&site='+sitesite,
    })
  },
  createroom(){
    wx.redirectTo({
      url: './home?id='+acidacid+'&site='+sitesite,
    })
  },
  zhuye(){
    wx.redirectTo({
      url: '../ayeshou/yeshou',
    })
  },
  click2(){
    this.setData({gqmode:false})
  }
})